<div class="row clearfix">
    <div class="col-md-12 column">
        <div class="col-md-4 column">
            <img src='/uploads/posters/<?php echo $movie_info->poster_large ?>'  
                 title='Filma: <?php echo $movie_info->title_en ?>'
                 alt='Movie poster'
            />
            <?php if(Auth::member(100)) { echo '<br><br><a class="btn btn-info" href="/movie/edit/'.$movie_info->id.'">'. __('EDIT') .'</a>'; } ?>
        </div>
        <div class="col-md-8 column">
            <h3>
                 <?php echo ($language == 'lv' ? $movie_info->title_lv : $movie_info->title_en) . ' ('. $movie_info->year .')'; ?>
            </h3>
            <h4><?php echo $movie_info->title_original ?></h4>
            
            <p>
                <span class="section-header"><?php echo __('DURATION')?></span>
                <?php echo gmdate("H:i", $movie_info->duration * 60); ?>
            </p>
            
            <p>
                <span class="section-header"><?php echo __('GENRES')?></span>
                <ul>
                <?php 
                    foreach($genres as $genre) {
                        echo '<li><a href="/genre/view/'. $genre->get('genre')->id .'">' . ($language == 'lv' ? $genre->get('genre')->genre_lv : $genre->get('genre')->genre_en) . '</a></li>';
                    }
                ?>
                </ul>
            </p>
            
            <p>
                <span class="section-header"><?php echo __('DESCRIPTION')?></span>
                <?php echo $language == 'lv' ? $movie_info->description_lv : $movie_info->description_en; ?>
            </p>
            
            <p>
                <span class="section-header"><?php echo __('NOT_RECOMMENDED')?></span>
                <strong><?php echo ($movie_info->age_restriction > 0 ? ($movie_info->age_restriction . ' gadu vecumam.') : 'Nav vecuma ierobežojuma'); ?></strong>
            </p>
            
            <p>
                <span class="section-header"><?php echo __('MOVIE_TRAILER')?></span>
                <a href='//www.youtube.com/watch?v=<?php echo $movie_info->video_id ?>' id='Youtube_Trailer'><?php echo __('WATCH_TRAILER')?></a>
            </p>
            
            <p>
                <span class="section-header"><?php echo __('UPCOMING_SHOWS')?></span>
                <?php 
                    if(isset($shows)) {
                        foreach($shows as $show) {
                            echo '<a href="/order/new/'.$show->id.'">' . date('d.m.Y H:i', $show->start_time) . '</a><br>';
                        }
                    } else {
                        echo __('NOT_FOUND');
                    }
                ?>
            </p>
        </div>
    </div>
    <div class="col-md-12 column">
        <h3><?php echo __('REVIEWS')?></h3>
        
        <?php if(count($reviews) == 0) echo '<p>'. __('NOT_FOUND') .'.</p>' ?>
        
        <?php 
            foreach($reviews as $review) {
                $stars = '';
                for($rating = 0; $rating < $review->rating; $rating++) {
                    $stars .= '<div class="rating-star"></div>';
                }
                
                echo 
                    '<div class="row clearfix">
                        <div class="col-md-10 column">
                            <div class="panel panel-default panel-body">
                                <div class="row clearfix">
                                    <div class="col-md-6 column">' .
                                        $review->username .
                                    '</div>
                                    <div class="col-md-3 column">' .     
                                        $stars .
                                    '</div>
                                    <div class="col-md-3 column">' .
                                        date('d.m.Y H:i', $review->date) .
                                    '</div>
                                </div><hr><p>' .
                                $review->review .
                            '</p></div>
                        </div>
                    </div>';
            }
        ?>
        
        <h3><?php echo __('ADD_REVIEW')?></h3>
        
        <?php echo Form::open(array('action' => 'movie/newreview', 'id' => 'reviewMovieForm')); ?>
        <div class="row clearfix">
            <div class="col-md-10 column">
                <div class="panel panel-default panel-body">
                    <div class="row clearfix">
                        <div class="col-md-8 column">
                            <?php echo __('REVIEW')?>
                        </div>
                        <div class="col-md-4 column">
                            <?php echo __('RATING')?>
                            <select name="Rating">
                                <option value="0" selected>---</option>
                                <option value="5">5</option>
                                <option value="4">4</option>
                                <option value="3">3</option>
                                <option value="2">2</option>
                                <option value="1">1</option>
                            </select>
                        </div>
                    </div>
                    <?php echo Form::textarea('Review', '', array("class"=>"form-control") ) .
                               Form::hidden('Movie_ID', $movie_info->id, array());
                    ?>
                </div>
            </div>
        </div>
        <?php echo Form::submit('SubmitButton', __('SUBMIT'), array("class"=>"btn btn-default") ); ?> 
        <?php echo Form::close(); ?>
        
        
    </div>
</div>

<?php echo Asset::css('jquery.fancybox.css'); ?>
<?php echo Asset::css('jquery.fancybox-buttons.css'); ?>
<?php echo Asset::js('jquery.fancybox.pack.js'); ?>
